---
title: Tool Type Generator
image: "https://og.composio.dev/api/og?title=Tool%20Type%20Generator"   # image for socials
description: "An example that show you how to showcase auth scheme and action params for tools"
keywords: "tool type generator, composio, sdk, tool calling"
subtitle: "Build your own platform using raw tool definitions"
hide-nav-links: true
---

This is a bit of a checky tutorial as it is dogfooding the `docs` tool generation process.

To motivate this example clearly, in our tools section — we have details about let's say [`Github`](/tools/github) tool, that shows its auth scheme, actions and their params.

Now why would anyone outside of Composio want to do this? Well if you are building a platform on top of Composio, perchance a Workflow builder like langflow. You would want to show some or all of this information to your users.

This is a non standard use case, that we support and love users building on top of us but if this is uninteresting to you, you can skip this tutorial.

## How does one build a tool type generator?

In composio, we have two internal states for tools

1. Raw tool definition
2. Provider tool definition

The raw tool definition is an generic input output schema definition that we internally for tools, we expose it for customers if they want to build on top of it but it is not the primary way tools are normally used.

The provider tool definition, translates this raw tool definition to the specific schema of a provider (by default `openai`). 

For building something like this, we need to use the raw tool definition.


## Getting the raw tool definition

Of course, you need to initiate the `Composio` sdk first and use a `COMPOSIO_API_KEY` environment variable.


<SnippetCode src="fern/generators/tool_doc_generator/main.py" path="tool_doc_generator/main.py" startLine={532} endLine={534} relativeHighlightStart={2} relativeHighlightEnd={2} wordWrap />


Let us see an example output for a raw `GMAIL` toolkit, with all of its tools.

this is just a taste but you can see the full output [here](https://github.com/composio-dev/composio/blob/next/fern/pages/src/examples/tool-generator/output.json).

<SnippetCode src="./output.json" path="output.json" startLine={1} endLine={100} />

```sh
jq '.[0] | keys' pages/src/examples/tool-generator/output.json
[
  "available_versions",
  "deprecated",
  "description",
  "input_parameters",
  "name",
  "no_auth",
  "output_parameters",
  "scopes",
  "slug",
  "tags",
  "toolkit",
  "version"
]
```

There is a bunch of useful information here, around the `input_parameters` and `output_parameters` for this example but `scopes` is very valuable to know what permissions are required for this tool.

Now from these `input_parameters` and `output_parameters` you can showcase the tool definitions.


<SnippetCode src="fern/generators/tool_doc_generator/main.py" path="tool_doc_generator/main.py" startLine={346} endLine={355} />

There is a bunch of other processing things happening here that are super generally relevant, so not going to call them out here that said there is another thing i want to showcase

## Toolkit Information

Toolkis are what we call apps or integrations, for us they are a collection of tools. `GMAIL` has `GMAIL_SEND_EMAIL` as a tool.

Now for building something out like this, you might also want information about the toolkit itself.

A toolkit has information like `categories` or `auth_schemes`

<SnippetCode src="fern/generators/tool_doc_generator/main.py" path="tool_doc_generator/main.py" startLine={534} endLine={537} />

`auth_schemes` here are `OAUTH2`, `API_KEY` or `BASIC_AUTH`, etc — essentially the types of how one could authenticate with the toolkit.

<SnippetCode src="fern/generators/tool_doc_generator/main.py" path="tool_doc_generator/main.py" startLine={543} endLine={552} />

Here is a way to parse the `auth_scheme` data


these are `tuple` objects as they have different schema for specific conditions like `auth_config_creation` or `connected_account_initiation`

they also have `required` and `optional` fields.

the context here is there are some fields you need while creating an auth config and some you need while connecting an account. this separation is done by the `tuple` here

<SnippetCode src="fern/generators/tool_doc_generator/main.py" path="tool_doc_generator/main.py" startLine={224} endLine={268} />


This is a fairly minimal explanation for the amount of code, as most of it is not super related to composio but it will be a good example on seeing behind the scenes of how composio is working and how to leverage the platform further.